<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>产品</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<style>
		html{ padding: 10px}
	</style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote">产品编辑</blockquote>
<form class="layui-form" id="bd1">


	<div class="layui-form-item">
		<label class="layui-form-label">产品名称</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName"  value="{$t.name}" name="name" lay-verify="required" placeholder="请输入产品名称">
		</div>
	</div>


	<div class="layui-form-item">



		

	</div>

	<div class="layui-form-item">


		
		<div class="layui-inline">
			<label class="layui-form-label">价格</label>
			<div class="layui-input-inline">
				<input type="number" name="price" value="{$t.price}" class="layui-input newsAuthor" lay-verify="required" placeholder="请输入价格">
			</div>
		</div>
         
         <div class="layui-form-item">


		 <label class="layui-form-label">选择分类</label>
		<div class="layui-input-inline">
				<select class="newsLook" name="cate" lay-filter="browseLook">
                   {empty name="t.cate"}
					<option value="0"></option>
					 {else />}
					<option>{$t.cate}</option>
					{/empty}


					{volist name="info" id="vo"}
					<option>{$vo.name}</option>
					{/volist}

				

				</select>
			</div>
		

	</div>




	</div>
    

<input type="hidden" name="tid" value="{$t.id}">

 <div class="layui-form-item">
		<label class="layui-form-label">产品关键词</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName"  value="{$t.tag}" name="tag" placeholder="请输入产品关键词">
		</div>
	</div>


	<div class="layui-form-item">
		<label class="layui-form-label">缩略图400*400</label>
		<div class="layui-input-block">

			{empty name="t.pic" }
			<img src="{:_STATIC}/img/nopic.jpg" width="200" height="200" id="pic" />
			{else /}
			<img src="{$t.pic}" width="200" height="200" id="pic" />

			{/empty}
		</div>

		<input name="pic" type="hidden" id="picval" value="{$t.pic}" />
	</div>


	<div class="layui-form-item">
		<label class="layui-form-label">产品详情</label>
		<div class="layui-input-block">
				<textarea name="content" id="news_content" style="height: 600px">


					{$t.content}
				</textarea>
		</div>
	</div>
	
	
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" type="button"  lay-submit="" lay-filter="addNews" >立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
{:jq()}
{:layui()}
{:ue()}
<script type="text/javascript">



    layui.upload.render({
        elem: '#pic'
        ,url: "{:url('api/upload/qiniu')}"
        ,size: 500000 //限制文件大小，单位 KB
        ,done: function(res){
        	if(res.code==200){
        		parent.layer.msg('上传成功');


             $("#picval").val(res.url);
             $("#pic").attr('src',res.url);

        	}
           
        }
    });
    var ue = UE.getEditor('news_content',{

        height:700
    });

    layui.form.on('submit(addNews)', function(data){
          
          $.post(' ',data.field,function(res){

                if(res.code==200){

                parent.layer.alert('保存成功，点确定继续上传',function(){

                     parent.layer.closeAll();
                     window.location.reload();

                });

                }


          });

        console.log(JSON.stringify(data.field));
        return false;
    });


</script>
</body>
</html>